<template>
    <view class="container data-v-01e45fec">
        <view class="header-tabs data-v-01e45fec">
            <view
                @tap="__e"
                :class="['tab-item', 'data-v-01e45fec', current == index ? 'active' : '']"
                :data-current="index"
                :data-event-opts="[['tap', [['currentChange', ['$event']]]]]"
                v-for="(item, index) in typeTextList"
                :key="index"
            >
                {{ '' + item + '' }}
            </view>
        </view>
        <view class="swiper-wrapper data-v-01e45fec">
            <swiper @change="__e" class="data-v-01e45fec" :current="current" :data-event-opts="[['change', [['currentChange2', ['$event']]]]]">
                <swiper-item class="data-v-01e45fec" v-for="(item, index) in $root.l0" :key="index">
                    <scroll-view @scrolltolower="__e" class="data-v-01e45fec" :data-event-opts="[['scrolltolower', [['scrolltolower', ['$event']]]]]" :scrollY="true">
                        <view class="list data-v-01e45fec">
                            <activity-item
                                @__l="__l"
                                class="data-v-01e45fec"
                                :info="item[$orig]"
                                :vueId="'2af22062-1-' + index + '-' + __i0__"
                                v-for="(item, __i0__) in dataList[index].list"
                                :key="__i0__"
                            ></activity-item>
                            <view class="load-more margin-v data-v-01e45fec" v-if="item.g0 < dataList[index].total">加载中...</view>
                            <no-data @__l="__l" class="data-v-01e45fec" tips="无订单" :vueId="'2af22062-2-' + index" v-if="item.g1"></no-data>
                        </view>
                    </scroll-view>
                </swiper-item>
            </swiper>
        </view>
        <i-action-sheet
            @__l="
                __l($event, {
                    eventOpts: [
                        ['^visibleChange', [['visibleChange']]],
                        ['^change', [['cancelOrder']]]
                    ]
                })
            "
            @change="
                __e($event, {
                    eventOpts: [
                        ['^visibleChange', [['visibleChange']]],
                        ['^change', [['cancelOrder']]]
                    ]
                })
            "
            @visibleChange="
                __e($event, {
                    eventOpts: [
                        ['^visibleChange', [['visibleChange']]],
                        ['^change', [['cancelOrder']]]
                    ]
                })
            "
            class="data-v-01e45fec"
            :data-event-opts="[
                ['^visibleChange', [['visibleChange']]],
                ['^change', [['cancelOrder']]]
            ]"
            :list="reasons"
            title="选择理由"
            :visible="visible"
            vueId="2af22062-3"
        ></i-action-sheet>
    </view>
</template>

<script>
import noData from '@/components/NoData/NoData';
import activityItem from '@/pages/myActivity/components/ActivityItem';
import iActionSheet from '@/components/ActionSheet/index';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/myActivity/index'],
    {
        '015f': function (t, n, e) {},
        '25b4': function (t, n, e) {
            'use strict';

            (function (t) {
                var i = e('4ea4');
                Object.defineProperty(n, '__esModule', {
                    value: true
                });
                n.default = void 0;
                var a = i(e('448a'));
                var r = {
                    components: {
                        ActivityItem: function () {
                            e.e('pages/myActivity/components/ActivityItem')
                                .then(
                                    function () {
                                        return resolve(e('f708'));
                                    }.bind(null, e)
                                )
                                .catch(e.oe);
                        },
                        IActionSheet: function () {
                            e.e('components/ActionSheet/index')
                                .then(
                                    function () {
                                        return resolve(e('fbfb'));
                                    }.bind(null, e)
                                )
                                .catch(e.oe);
                        },
                        NoData: function () {
                            e.e('components/NoData/NoData')
                                .then(
                                    function () {
                                        return resolve(e('cafe'));
                                    }.bind(null, e)
                                )
                                .catch(e.oe);
                        }
                    },
                    data: function () {
                        return {
                            order: {},
                            reasons: [],
                            visible: false,
                            dataList: [],
                            current: 0,
                            types: ['working', 'expired'],
                            typeTextList: ['进行中', '已结束']
                        };
                    },
                    onLoad: function (t) {
                        this.current = t.current ? parseInt(t.current) : 0;
                        this.initData();
                        this.getOrderList();
                    },
                    onUnload: function () {},
                    methods: {
                        scrolltolower: function () {
                            this.dataList[this.current].page++;
                            this.getOrderList();
                        },
                        initData: function () {
                            var that = this;
                            this.dataList = [];
                            this.types.forEach(function (n) {
                                that.dataList.push({
                                    list: [],
                                    type: n,
                                    page: 1,
                                    per_page: 50,
                                    total: 0,
                                    init: false,
                                    loading: false
                                });
                            });
                        },
                        currentChange: function (t) {
                            var n = t.currentTarget.dataset.current;
                            if (n !== this.current) {
                                this.current = n;
                                var e = this.dataList[this.current];
                                console.log(e);
                                e.init || this.getOrderList();
                            }
                        },
                        currentChange2: function (t) {
                            var n = t.detail.current;
                            if (n !== this.current) {
                                this.current = n;
                                this.dataList[this.current].init || this.getOrderList();
                            }
                        },
                        getOrderList: function () {
                            var n = this.dataList[this.current];
                            n.loading ||
                                (n.init ||
                                    t.showLoading({
                                        title: '加载中',
                                        mask: true
                                    }),
                                (n.loading = true),
                                this.$http('/activity-records', 'GET', {
                                    status: n.type,
                                    page: n.page,
                                    per_page: n.per_page
                                }).then(function (e) {
                                    var i;
                                    t.hideLoading();
                                    n.loading = false;
                                    (i = n.list).push.apply(i, (0, a.default)(e.data.list));
                                    n.total = e.data.item_total;
                                    n.init = true;
                                }));
                        }
                    }
                };
                n.default = r;
            }.call(this, e('543d').default));
        },
        '7df9': function (t, n, e) {
            'use strict';

            e.d(n, 'b', function () {
                return a;
            });
            e.d(n, 'c', function () {
                return r;
            });
            e.d(n, 'a', function () {
                return i;
            });
            var i = {
                NoData: function () {
                    return e.e('components/NoData/NoData').then(e.bind(null, 'cafe'));
                }
            };
            var a = function () {
                var that = this;
                var n =
                    (that.$createElement,
                    that._self._c,
                    that.__map(that.types, function (n, e) {
                        return {
                            $orig: that.__get_orig(n),
                            g0: that.dataList[e].list.length,
                            g1: that.dataList[e].init && !that.dataList[e].list.length
                        };
                    }));
                that.$mp.data = Object.assign(
                    {},
                    {
                        $root: {
                            l0: n
                        }
                    }
                );
            };
            var r = [];
        },
        8444: function (t, n, e) {
            'use strict';

            var i = e('015f');
            e.n(i).a;
        },
        a3eb: function (t, n, e) {
            'use strict';

            (function (t, n) {
                var i = e('4ea4');
                e('18ba');
                i(e('66fd'));
                var a = i(e('f6ef'));
                t.__webpack_require_UNI_MP_PLUGIN__ = e;
                n(a.default);
            }.call(this, e('bc2e').default, e('543d').createPage));
        },
        ecb0: function (t, n, e) {
            'use strict';

            e.r(n);
            var i = e('25b4');
            var a = e.n(i);
            for (var r in i) {
                if (['default'].indexOf(r) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return i[t];
                        });
                    })(r);
                }
            }
            n.default = a.a;
        },
        f6ef: function (t, n, e) {
            'use strict';

            e.r(n);
            var i = e('7df9');
            var a = e('ecb0');
            for (var r in a) {
                if (['default'].indexOf(r) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return a[t];
                        });
                    })(r);
                }
            }
            e('8444');
            var o = e('f0c5');
            var c = Object(o.a)(a.default, i.b, i.c, false, null, '01e45fec', null, false, i.a, void 0);
            n.default = c.exports;
        }
    },
    [['a3eb', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
